<%@ include file="/WEB-INF/views/includes.jsp" %>
<%@ include file="/WEB-INF/views/header.jsp" %>
<%@ page session="false" %>

<h1>${operation} Course</h1>

<form:form commandName="course" method="POST" autocomplete="off">
	
	<fieldset>
		<legend>Course Attributes</legend>
		
		<table style="width:100%;">
			<tr>
				<td style="width:150px;">CRN:</td>
				<td>
					<c:choose>
						<c:when test="${operation == 'Add'}">
							<form:input path="crn" id="crn" disabled="${operation=='Edit'}" />
						</c:when>
						<c:otherwise>
							<form:hidden path="crn" id="crn" />
							<input type="text" value="${course.crn}" disabled="disabled" />
						</c:otherwise>
					</c:choose>
					<form:errors path="crn" cssClass="error" />
				</td>
			</tr>
			<tr>
				<td>Code:</td>
				<td>
					<form:input path="code" id="code" />
					<form:errors path="code" cssClass="error" />
				</td>
			</tr>
			<tr>
				<td>Name:</td>
				<td>
					<form:input path="name" id="name" />
					<form:errors path="name" cssClass="error" />
				</td>
			</tr>
		</table>
	</fieldset>

	<fieldset style="margin-top:20px;">
		<legend>Registered Students</legend>
		<p>Select the students that you would like to be registered in this course.  <strong>Hold CTRL to select multiple students.</strong></p>
		<center>
			<form:select path="students" multiple="true" items="${students}" itemValue="id" itemLabel="name" style="width:300px;"/>
		</center>
	</fieldset>
	
	
	<fieldset style="margin-top:20px;">
		<legend>Documents</legend>
		<p>Select the documents that you would like to be visible to the students registered in this course. <strong>Hold CTRL to select multiple documents.</strong></p>
		<center>
			<form:select path="documents" multiple="true" items="${documents}" itemValue="id" itemLabel="fileName" style="width:300px;"/>
		</center>
	</fieldset>
	
	<div style="text-align:right;">
		<input type="submit" value="Save" />
		<input type="button" value="Cancel" onclick="javascript:window.history.go(-1);" />
	</div>

</form:form>

<%@ include file="/WEB-INF/views/footer.jsp" %>